package com.chenfan.process.biz.impl;

import java.util.List;
import java.util.stream.Collectors;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.chenfan.process.biz.ApprovalTemplateQueryBiz;
import com.chenfan.process.entity.po.ApprovalTemplatePo;
import com.chenfan.process.entity.vo.ApprovalTemplateVo;
import com.chenfan.process.service.ApprovalTemplateService;

/**
 * @author liuming
 * @date 2021/10/26
 */
@Service
public class ApprovalTemplateQueryBizImpl implements ApprovalTemplateQueryBiz {

    @Autowired
    private ApprovalTemplateService approvalTemplateService;

    @Override
    public List<ApprovalTemplateVo> listTemplate() {
        List<ApprovalTemplatePo> list = approvalTemplateService.listAvailableApproval();
        return list.stream().map(ApprovalTemplatePo::copyApprovalTemplateVo).collect(Collectors.toList());
    }
}
